using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Resources;
using System.Reflection;
using System.Windows.Forms;
using MisErrores;


namespace Clinica
{

    public class ControladorPantalla
    {
        private MessageBoxError _errorLocal ;

        protected MessageBoxError ErrorLocal
        {
            get 
            {
                if (_errorLocal== null)
                {
                    _errorLocal = new MessageBoxError();        
                }
                return _errorLocal; }
            set { _errorLocal = value; }
        }
        private clsValidadora _validar;

        protected clsValidadora Validar
        {
            get 
            {
                if (_validar == null)
                {
                    _validar = new clsValidadora();
                }
                return _validar; }
            set { _validar = value; }
        }
        private ctrlErrores _manejadorError;

        protected ctrlErrores ManejadorError
        {
            get 
            {
                if (_manejadorError == null)
                {
                    _manejadorError = new ctrlErrores();
                }
                return _manejadorError; }
            set { _manejadorError = value; }
        }
        
        private const string SPANISH = "SPANISH";
        private const string ENGLISH = "ENGLISH";
        public string TomarTexto(string key)
        {
            string lenguajeUI = ConfigurationManager.AppSettings.Get("lenguajeUI");
            string value = "";

            // Declare a Resource Manager instance.
            ResourceManager rec = new ResourceManager("Clinica.SPANISH", typeof(frmMain).Assembly);
            // Assign the string 
            value = rec.GetString(key);

            return value;
        }

        public void BindingDTS(ref BindingNavigator nav, ref BindingSource bnd,DataSet dts)
        {
            bnd.DataSource = dts;
            bnd.DataMember = dts.Tables[0].TableName;

            nav.BindingSource = bnd;
        }
    }
}
